| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
libdar::data_tree Class Reference
Private

the data_tree class stores presence of a given file in a set of archives More...

`#include <data_tree.hpp>`

Inherited by libdar::data_dir.

## Public Member Functions
| data_tree (const std::string &name)
| data_tree (generic_file &f, unsigned char db_version)
| constructor does not read signature
| data_tree (const data_tree &ref)=default
| data_tree (data_tree &&ref) noexcept=default
data_tree & | operator= (const data_tree &ref)=default
data_tree & | operator= (data_tree &&ref) noexcept=default
virtual void | dump (generic_file &f) const
| dump signature followed by data constructor will read
std::string | get_name () const
void | set_name (const std::string &name)
db_lookup | get_data (std::set< archive_num > &archive, const datetime &date, bool even_when_removed) const
db_lookup | get_EA (archive_num &archive, const datetime &date, bool even_when_removed) const
| if EA has been saved alone later, returns in which version for the state of the file at the given date.
bool | read_data (archive_num num, datetime &val, db_etat &present) const
| return the date of file's last modification date within the give archive and whether the file has been saved or deleted
bool | read_EA (archive_num num, datetime &val, db_etat &present) const
| return the date of last inode change and whether the EA has been saved or deleted
void | set_data (const archive_num &archive, const datetime &date, db_etat present)
void | set_data (const archive_num &archive, const datetime &date, db_etat present, const crc *base, const crc *result)
void | set_EA (const archive_num &archive, const datetime &date, db_etat present)
virtual bool | check_order (user_interaction &dialog, const path &current_path, bool &initial_warn) const
| check date order between archives withing the database ; throw Erange if problem found with date order
virtual void | finalize (const archive_num &archive, const datetime &deleted_date, const archive_num &ignore_archive_greater_or_equal)
| add deleted entry if no object of the current archive exist and the entry of the previous archive is already present.
virtual bool | remove_all_from (const archive_num &archive_to_remove, const archive_num &last_archive)
| return true if the corresponding file is no more located in any archive (thus, the object is no more usefull in the base)
void | listing (database_listing_get_version_callback callback, void *tag) const
| list where is saved this file
virtual void | apply_permutation (archive_num src, archive_num dst)
virtual void | skip_out (archive_num num)
| decrement archive numbers above num
virtual void | compute_most_recent_stats (std::deque< infinint > &data, std::deque< infinint > &ea, std::deque< infinint > &total_data, std::deque< infinint > &total_ea, const datetime &ignore_older_than_that) const
| provide a summary of the latest version of file and ea per archive number of the database
virtual void | compute_restoration_needed_archives (std::deque< infinint > &data, std::deque< infinint > &ea, std::deque< infinint > &total_data, std::deque< infinint > &total_ea, const datetime &ignore_older_than_that) const
| provide a summary of the archives that will be required to restore the data in the latest state
virtual char | obj_signature () const
virtual bool | fix_corruption ()

## Static Public Member Functions
static char | signature ()

## Private Member Functions
template<class T >
bool | check_map_order (user_interaction &dialog, const std::map< archive_num, T > the_map, const path &current_path, const std::string &field_nature, bool &initial_warn) const
bool | check_delta_validity ()
void | compute_for_flag_set (std::deque< infinint > &data, std::deque< infinint > &ea, std::deque< infinint > &total_data, std::deque< infinint > &total_ea, const datetime &ignore_older_than_that, const std::set< db_etat > &flag_set, bool even_when_removed) const
| give number of entry's last state (for data and ea) per archive number, followed by the total number of stored in each archive

## Static Private Member Functions
static archive_num | data_tree_permutation (archive_num src, archive_num dst, archive_num x)
| gives new archive number when an database has its archive reordered
static void | display_line (database_listing_get_version_callback callback, void *tag, archive_num num, const datetime *data, db_etat data_presence, const datetime *ea, db_etat ea_presence)
| helper method to provide information to a database_listing_get_version_callback

## Private Attributes
std::string | filename
std::map< archive_num, status_plus > | last_mod
| key is archive number ; value is last_mod time
std::map< archive_num, status > | last_change
| key is archive number ; value is last_change time

## Static Private Attributes
static constexpr const char *const | ETAT_SAVED = "S"
static constexpr const char *const | ETAT_PATCH = "O"
static constexpr const char *const | ETAT_PATCH_UNUSABLE = "U"
static constexpr const char *const | ETAT_PRESENT = "P"
static constexpr const char *const | ETAT_REMOVED = "R"
static constexpr const char *const | ETAT_ABSENT = "A"
static constexpr const char *const | ETAT_INODE = "I"
static constexpr unsigned char | STATUS_PLUS_FLAG_ME = 0x01
static constexpr unsigned char | STATUS_PLUS_FLAG_REF = 0x02

## Detailed Description

the data_tree class stores presence of a given file in a set of archives

the data associated to a given file are the different modification dates that this file has been found in the archive the database has been feed by

Definition at line 53 of file data_tree.hpp.

## Member Function Documentation

## ◆ check_order()

virtual bool libdar::data_tree::check_order | ( | user_interaction & | dialog,
|  | const path & | current_path,
|  | bool & | initial_warn ) const
| inline virtual

check date order between archives withing the database ; throw Erange if problem found with date order

Reimplemented in libdar::data_dir.

Definition at line 100 of file data_tree.hpp.

References last_change, and last_mod.

## ◆ compute_for_flag_set()

void libdar::data_tree::compute_for_flag_set | ( | std::deque< infinint > & | data,
|  | std::deque< infinint > & | ea,
|  | std::deque< infinint > & | total_data,
|  | std::deque< infinint > & | total_ea,
|  | const datetime & | ignore_older_than_that,
|  | const std::set< db_etat > & | flag_set,
|  | bool | even_when_removed ) const
| private

give number of entry's last state (for data and ea) per archive number, followed by the total number of stored in each archive

Parameters

  [in] | data | table giving for each archive the number of latest data entry (considering states from the flag_set provided set argument)
  [in] | ea | table giving for each archive the number of latest EA entry (considering states from the flag_set provided set argument)
  [in] | total_data | table giving for each archive the total number of data entry (considering states from the flag_set provided set argument)
  [in] | total_ea | table giving for each archive the total number of EA entry (considering states from the flag_set provided set argument)
  [in] | ignore_older_than_that | focus the computation on version not more recent that this date
  [in] | flag_set | set of state to consider (other states are not taken into account when looking for the archive number of the latest entry)
  [in] | even_when_removed | by default, do not count in any archive a entry which latest state is removed or absent, else increment the archive of most recent state (as define by flag_set) for each entry, even if the most recent state is removed or absent.

## ◆ compute_most_recent_stats()

virtual void libdar::data_tree::compute_most_recent_stats | ( | std::deque< infinint > & | data,
|  | std::deque< infinint > & | ea,
|  | std::deque< infinint > & | total_data,
|  | std::deque< infinint > & | total_ea,
|  | const datetime & | ignore_older_than_that ) const
| virtual

provide a summary of the latest version of file and ea per archive number of the database

Parameters

  [out] | data | is a table indexed by archive num providing the number latest data version per archive
  [out] | ea | is a table indexed by archive num providing the number latest EA version per archive
  [out] | total_data | is a table indexed by archive providing the total number of entries with data, archive per archive (most recent and older)
  [out] | total_ea | is a table indexed by archive num providing the total number of entries with EA, archive per archive (most recent and older)
  [in] | ignore_older_than_that | if not null date, ignore data et EA versions strictly more recent than this date

Note
  the provided four fields that will receive table of counters per archive should be initialized by the caller as this is a recursive call with data_dir that increment the counter recursively.

Reimplemented in libdar::data_dir.

## ◆ compute_restoration_needed_archives()

virtual void libdar::data_tree::compute_restoration_needed_archives | ( | std::deque< infinint > & | data,
|  | std::deque< infinint > & | ea,
|  | std::deque< infinint > & | total_data,
|  | std::deque< infinint > & | total_ea,
|  | const datetime & | ignore_older_than_that ) const
| virtual

provide a summary of the archives that will be required to restore the data in the latest state

Note
  if ignore_older_than_that is set, the result concerns the latest state for the provided date and ignores data from a more recent state.

Reimplemented in libdar::data_dir.

## ◆ data_tree_permutation()

static archive_num libdar::data_tree::data_tree_permutation | ( | archive_num | src,
|  | archive_num | dst,
|  | archive_num | x )
| static private

gives new archive number when an database has its archive reordered

Parameters

  [in] | src | the archive number to move
  [in] | dst | the new position of the archive number given by src
  [in] | x | any archive number in the database, which new position is to be calculated in regard to the src -> dst move

Returns
  the new archive number of archive x in regard to the src -> dst move

## ◆ dump()

virtual void libdar::data_tree::dump | ( | generic_file & | f | ) | const
| virtual

dump signature followed by data constructor will read

Reimplemented in libdar::data_dir.

## ◆ finalize()

virtual void libdar::data_tree::finalize | ( | const archive_num & | archive,
|  | const datetime & | deleted_date,
|  | const archive_num & | ignore_archive_greater_or_equal )
| virtual

add deleted entry if no object of the current archive exist and the entry of the previous archive is already present.

Parameters

  [in] | archive | is the number of the archive to finalize
  [in] | deleted_date | date of deletion to use for inode removal when no information can be grabbed from the archive (this date is taken from the parent dir last modification date)
  [in] | ignore_archive_greater_or_equal | ignore archives which number is greater or equal than "ignore_archive_greater_or_equal" as if they were not present in the database. If set to zero, no archive is ignored.

Reimplemented in libdar::data_dir.

## ◆ get_data()

db_lookup libdar::data_tree::get_data | ( | std::set< archive_num > & | archive,
|  | const datetime & | date,
|  | bool | even_when_removed ) const

returns the archives to restore in order to obtain the data that was defined just before (or at) the given date

Parameters

  [out] | archive | is the set of archive to restore in sequence to obtain the requested data
  [in] | date | date above which to ignore data found in the database
  [in] | even_when_removed | is true when user requested to restore the file in its latest state even if it has been removed afterward

Returns
  the success of failure status of the requested lookup

## ◆ get_name()

std::string libdar::data_tree::get_name | ( |  | ) | const
| inline

Definition at line 65 of file data_tree.hpp.

## ◆ obj_signature()

virtual char libdar::data_tree::obj_signature | ( |  | ) | const
| inline virtual

Definition at line 152 of file data_tree.hpp.

## ◆ remove_all_from()

virtual bool libdar::data_tree::remove_all_from | ( | const archive_num & | archive_to_remove,
|  | const archive_num & | last_archive )
| virtual

return true if the corresponding file is no more located in any archive (thus, the object is no more usefull in the base)

Reimplemented in libdar::data_dir.

## ◆ set_data() [1/2]

void libdar::data_tree::set_data | ( | const archive_num & | archive,
|  | const datetime & | date,
|  | db_etat | present )
| inline

Definition at line 87 of file data_tree.hpp.

## ◆ set_data() [2/2]

void libdar::data_tree::set_data | ( | const archive_num & | archive,
|  | const datetime & | date,
|  | db_etat | present,
|  | const crc * | base,
|  | const crc * | result )
| inline

Definition at line 91 of file data_tree.hpp.

## ◆ set_EA()

void libdar::data_tree::set_EA | ( | const archive_num & | archive,
|  | const datetime & | date,
|  | db_etat | present )
| inline

Definition at line 97 of file data_tree.hpp.

## ◆ set_name()

void libdar::data_tree::set_name | ( | const std::string & | name | ) |
| inline

Definition at line 66 of file data_tree.hpp.

## ◆ signature()

static char libdar::data_tree::signature | ( |  | ) |
| inline static

Definition at line 153 of file data_tree.hpp.

## ◆ skip_out()

virtual void libdar::data_tree::skip_out | ( | archive_num | num | ) |
| virtual

decrement archive numbers above num

Reimplemented in libdar::data_dir.

## Member Data Documentation

## ◆ ETAT_ABSENT

const char* const libdar::data_tree::ETAT_ABSENT = "A"
| static constexpr private

Definition at line 165 of file data_tree.hpp.

## ◆ ETAT_INODE

const char* const libdar::data_tree::ETAT_INODE = "I"
| static constexpr private

Definition at line 166 of file data_tree.hpp.

## ◆ ETAT_PATCH

const char* const libdar::data_tree::ETAT_PATCH = "O"
| static constexpr private

Definition at line 161 of file data_tree.hpp.

## ◆ ETAT_PATCH_UNUSABLE

const char* const libdar::data_tree::ETAT_PATCH_UNUSABLE = "U"
| static constexpr private

Definition at line 162 of file data_tree.hpp.

## ◆ ETAT_PRESENT

const char* const libdar::data_tree::ETAT_PRESENT = "P"
| static constexpr private

Definition at line 163 of file data_tree.hpp.

## ◆ ETAT_REMOVED

const char* const libdar::data_tree::ETAT_REMOVED = "R"
| static constexpr private

Definition at line 164 of file data_tree.hpp.

## ◆ ETAT_SAVED

const char* const libdar::data_tree::ETAT_SAVED = "S"
| static constexpr private

Definition at line 160 of file data_tree.hpp.

## ◆ filename

std::string libdar::data_tree::filename
| private

Definition at line 217 of file data_tree.hpp.

## ◆ last_change

std::map<archive_num, status> libdar::data_tree::last_change
| private

key is archive number ; value is last_change time

Definition at line 219 of file data_tree.hpp.

Referenced by check_order().

## ◆ last_mod

std::map<archive_num, status_plus> libdar::data_tree::last_mod
| private

key is archive number ; value is last_mod time

Definition at line 218 of file data_tree.hpp.

Referenced by check_order().

## ◆ STATUS_PLUS_FLAG_ME

unsigned char libdar::data_tree::STATUS_PLUS_FLAG_ME = 0x01
| static constexpr private

Definition at line 168 of file data_tree.hpp.

## ◆ STATUS_PLUS_FLAG_REF

unsigned char libdar::data_tree::STATUS_PLUS_FLAG_REF = 0x02
| static constexpr private

Definition at line 169 of file data_tree.hpp.

The documentation for this class was generated from the following file:

- data_tree.hpp